#include "Goomba.h"

Goomba::Goomba()
{
    CEntity::Col_X = 0;
    CEntity::Col_Width = 0;
    CEntity::DeathFrames = 3;
    CEntity::Type = ENTITY_TYPE_ENEMY;
}
 
bool Goomba::OnLoad(char* File, int Width, int Height, int MaxFrames)
{
    if(CEntity::OnLoad(File, Width, Height, MaxFrames) == false)
    {
        return false;
    }
    return true;
}
 
void Goomba::OnLoop()
{
    CEntity::OnLoop();
}
 
void Goomba::OnRender(SDL_Surface* Surf_Display)
{
    CEntity::OnRender(Surf_Display);
}
 
void Goomba::OnCleanup()
{
    CEntity::OnCleanup();
}
 
void Goomba::OnAnimate()
{    
    if(!CEntity::Dying)
    {
        Anim_Control.MaxFrames = 2;
    }
 
    CEntity::OnAnimate();
}


bool Goomba::OnCollision(CEntity* Entity)
{
    if(Entity->Type == ENTITY_TYPE_PLAYER)
    {
        if(((Entity->Y + Entity->Height) < (Y + Height/2)) && !Dying)
        {
            StartDeath();
            CEntity::CurrentFrameCol = 1;
            Anim_Control.SetCurrentFrame(0);
            Anim_Control.MaxFrames = 3;
            //.....\o/......^.... SHARK ATTACK
            Anim_Control.SetOneTimeAnimation(&Dead);
        }
    }
    return true;
}